package com.huilink.webmail.util.client.widgets;

import com.google.gwt.user.client.ui.ChangeListener;
import com.google.gwt.user.client.ui.PasswordTextBox;

public class PwdInputPanel extends InputPanel{

	private PasswordTextBox pwdBox;

	public PwdInputPanel(String key, String value, String description){
		setDescription(description);
		setOriginValue(value);
		pwdBox = new PasswordTextBox();
		pwdBox.setName(key);
		setValue(value);
		setInputWidget(pwdBox);
		pwdBox.setStyleName("input-panel-textbox");
		initInputPanel();
	}

	public void setValue(String value) {
		if(value!=null)pwdBox.setText(value);
		else pwdBox.setText("");
	}

	public void addChangeListener(ChangeListener listener) {
		pwdBox.addChangeListener(listener);
	}

	public String getValue() {
		return pwdBox.getText();
	}
	
	public void reset() {
		setValue(getOriginValue());
	}
	
	public void setWidth(String value){
		pwdBox.setWidth(value);
	}
	
}
